<?php

// Base class zuSQL
abstract class zuSQL
{
	protected $member;

	// The singleton method
	/*
	private static $instance;
	public static function singleton() 
	{
		if( !isset( self::$instance ) ) {
			$c = __CLASS__;
			self::$instance = new $c;
		}
		return self::$instance;
	}
	*/

	protected function __construct()
	{
		echo "Base class constructed<br>";
		$this->member = "This is class zuSQL<br>";
	}

	function GetErrInfo()
	{
		return $this->member;
	}

	function GetClassName()
	{
		return __CLASS__ . "\n";
	}
}

// Derived class zuSQL_SongFeatures
class zuSQL_SongFeatures extends zuSQL
{
	// The singleton method
	private static $instance;
	public static function singleton() 
	{
		if( !isset( self::$instance ) ) {
			$c = __CLASS__;
			self::$instance = new $c;
		}
		return self::$instance;
	}

	protected function __construct()
	{
		parent::__construct();
		$this->member = "This is class zuSQL_SongFeatures<br>";
	}

	function GetClassName()
	{
		return __CLASS__ . "\n";
	}
}

//$SQLObj = new zuSQL;
//$SQLObj = new zuSQL_SongFeatures;
$SQLObj = zuSQL_SongFeatures::singleton();

$errInfo = $SQLObj->GetErrInfo();
echo $errInfo;
$className = $SQLObj->GetClassName();
echo $className;

?>
